package com.light.roller;

import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;
import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.ui.activity.BaseGameActivity;

import com.light.buttons.StartButton;
import com.light.gamecomponents.IGameComponents;

public class Menu implements IGameComponents{
	
	protected BaseGameActivity m_game;
	protected TextureRegion m_textureRegion;
	protected Sprite m_sprite;
	protected StartButton m_startButton;
	
	
	public Menu(BaseGameActivity game)
	{
		m_game = game; 
		m_startButton = new StartButton(game);
	}
	@Override
	public void onLoadResources()
	{
		ResourceManager.onLoadResources("Menu", m_game);
		m_textureRegion = ResourceManager.getTextureRegion("Menu");
		m_startButton.onLoadResources(); 
	}
	@Override
	public void unLoadResources()
	{
		m_textureRegion = null;
		ResourceManager.unLoadResources("Menu", m_game);
		
	}
	@Override
	public void onLoadEngine()
	{
		
	}
	@Override
	public void onLoadScene(Scene scene, PhysicsWorld physicsWorld)
	{
		m_sprite = new Sprite(0, 0, m_textureRegion);
		scene.attachChild(m_sprite);
		m_startButton.onLoadScene(scene, physicsWorld);
	}
	@Override
	public void removeFromScene(Scene scene, PhysicsWorld physicsWorld)
	{
		scene.detachChild(m_sprite);
		m_startButton.removeFromScene(scene, physicsWorld);
		m_sprite = null;
		m_startButton = null;
	}
	@Override
	public void rotate(float angle) {
		// TODO Auto-generated method stub
		
	}


}
